import { createStore } from 'vuex'
import VuexPersistence from 'vuex-persist'
import state from './state'
import actions from './actions'
import mutations from './mutations'

const vuexLocal = new VuexPersistence({
  storage: window.localStorage,
})

const store = createStore({
  state () {
    return {
      site: {
        title: '八哥网',
        desc: '在线bug监控平台',
        homePage: 'https://www.verybugs.com',
      },
      ...state,
    }
  },
  mutations,
  actions,
  plugins: [vuexLocal.plugin],
})

export default store
